// 打开目标页
export const NAV_TO = (url, parmas = null) => {
  if(parmas) {
    var querystring = "?";
    Object.keys(parmas).forEach(key => {
      querystring = querystring + key + "=" + parmas[key] + "&"
    })
    uni.navigateTo({
      url: url + querystring
    })
  } else {
    uni.navigateTo({
      url,
    })
  }
}

// 打开tabbar页面
export const NAV_TAB = (url) => {
  uni.switchTab({
    url
  })
}

export const TOAST_SHOW_SUCCESS = (title = "数据加载失败", icon = "success") => {
  uni.showToast({
    title,
    icon
  })
}

export const TOAST_SHOW_FAIL = (title = "数据加载失败", icon = "error") => {
  uni.showToast({
    title,
    icon
  })
}